package com.syni.mdd.yhd.common.all.utils.tcloud;

import com.google.gson.JsonSyntaxException;
import com.google.gson.reflect.TypeToken;
import com.tencentcloudapi.common.AbstractClient;
import com.tencentcloudapi.common.Credential;
import com.tencentcloudapi.common.JsonResponseModel;
import com.tencentcloudapi.common.exception.TencentCloudSDKException;
import com.tencentcloudapi.common.profile.ClientProfile;
import com.tencentcloudapi.vod.v20180717.models.ApplyUploadRequest;
import com.tencentcloudapi.vod.v20180717.models.ApplyUploadResponse;

import java.lang.reflect.Type;

/**
 * @className VodQcloudClient
 * @description TOO
 * @Author cfx
 * @DATE 2019/12/25 14:37
 * @VERSION 1.0
 **/
public class VodQcloudClient extends AbstractClient {

    private static String endpoint = "vod.api.qcloud.com";
    private static String version = "2019-12-25";

    public VodQcloudClient(Credential credential, String region) {
        this(credential, region, new ClientProfile());
    }

    public VodQcloudClient(Credential credential, String region, ClientProfile profile) {
        super(endpoint, version, credential, region, profile);
    }

    public ApplyUploadResponse createSimpleAesTemplate(ApplyUploadRequest req) throws TencentCloudSDKException {
        JsonResponseModel rsp = null;

        try {
            Type type = (new TypeToken<JsonResponseModel<ApplyUploadResponse>>() {
            }).getType();
            rsp = (JsonResponseModel)this.gson.fromJson(this.internalRequest(req, "ApplyUpload"), type);
        } catch (JsonSyntaxException var4) {
            throw new TencentCloudSDKException(var4.getMessage());
        }

        return (ApplyUploadResponse)rsp.response;
    }
}
